'use strict'
var school = require('./n2/school');
var city = require('./n2/city');
var n2 = require('./n2');//require文件夹默认导入n2/package.json里面的main属性所指向的文件
var moment = require('moment');

class TestModule {

    constructor(){
        let name = 'N1';

        this.obj1 = {
            name: name,
            boy: true,
            say: 'Helloworld! I\'m ' + name,
            age: 22
        };
        this.obj2 = Object.assign({}, this.obj1, {
            name: 'N2'
        });
    }

    sayHello(){
        console.log(this.obj2.say);
        console.log(JSON.stringify(this.obj2));
    }

    helloFromSchool(){
        school.hello();
        this.calculate();
    }

    calculate(){
        console.log(school.calculate(1,2));
    }
}

var m = new TestModule();
m.sayHello();
m.helloFromSchool();

//from school module
console.log('name:' + school.name);
console.log('site:' + school.site());

//from city module
console.log('city:' + city.name);
city.showWeather();

//from moment module
console.log('moment:' + moment().format("YYYY-MM-DD"));

//from ns/index
console.log('n2/index: ' + n2.name);